home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_064 / include / iff / readpict.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  63 lines

  1. #ifndef READPICT_H
  2. #define READPICT_H
  3. /** ReadPict.h **************************************************************/
  4. /*                                        */
  5. /* Read an ILBM raster image file into RAM.   1/23/86.                */
  6. /*                                        */
  7. /* By Jerry Morrison, Steve Shaw, and Steve Hayes, Electronic Arts.        */
  8. /* This software is in the public domain.                    */
  9. /*                                        */
  10. /* USE THIS AS AN EXAMPLE PROGRAM FOR AN IFF READER.                */    
  11. /*                                        */
  12. /* The IFF reader portion is essentially a recursive-descent parser.        */    
  13. /****************************************************************************/
  14.  
  15. /* ILBMFrame is our "client frame" for reading FORMs ILBM in an IFF file.
  16.  * We allocate one of these on the stack for every LIST or FORM encountered
  17.  * in the file and use it to hold BMHD & CMAP properties. We also allocate
  18.  * an initial one for the whole file. */
  19. typedef struct {
  20.    ClientFrame clientFrame;
  21.    UBYTE foundBMHD;
  22.    UBYTE nColorRegs;
  23.    BitMapHeader bmHdr;
  24.    Color4 colorMap[32 /*1<<MaxAmDepth*/ ];
  25.    /* If you want to read any other property chunks, e.g. GRAB or CAMG, add
  26.     * fields to this record to store them. */
  27.    } ILBMFrame;
  28.  
  29. /** ReadPicture() ***********************************************************
  30.  *
  31.  * Read a picture from an IFF file, given a file handle open for reading.
  32.  * Allocates BitMap RAM by calling (*Allocator)(size).
  33.  *
  34.  ****************************************************************************/
  35.  
  36. typedef UBYTE *UBytePtr;
  37.  
  38. #ifdef FDwAT
  39.  
  40. typedef UBytePtr Allocator(LONG);
  41.    /* Allocator: a memory allocation procedure which only requires a size
  42.     * argument. (No Amiga memory flags argument.) */
  43.  
  44. extern IFFP ReadPicture(LONG, struct BitMap *, ILBMFrame *, Allocator *);
  45.             /*  file, bm,              iFrame,      allocator  */
  46.    /* iFrame is the top level "client frame". */
  47.    /* allocator is a ptr to your allocation procedure. It must always
  48.     *   allocate in Chip memory (for bitmap data). */
  49.  
  50.    /* PS: Notice how we used two "typedef"s above to make allocator's type
  51.     * meaningful to humans.
  52.     * Consider the usual C style: UBYTE *(*)(), or is it (UBYTE *)(*()) ? */
  53.  
  54. #else /* not FDwAT */
  55.  
  56. typedef UBytePtr Allocator();
  57. extern IFFP ReadPicture();
  58.  
  59. #endif
  60.  
  61. #endif READPICT_H
  62.  
  63.